package com.sun.showcase.controller.app.mall;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.aliyuncs.utils.StringUtils;
import com.sun.showcase.biz.mall.service.MemberBillService;
import com.sun.showcase.client.query.mall.MemberBillQuery;
import com.sun.showcase.pojo.DataGrid;
import com.sun.showcase.pojo.Result;

@Controller("appMemberBillController")
@RequestMapping(value="/app/memberBill") 
public class MemberBillController{
	
	@Autowired
	private MemberBillService memberBillService;
	
	private Result result = new Result();
	

	/**
	 * 获得分页数据表格
	 */
	@ResponseBody
	@RequestMapping(value = "/list")
	public Result list(MemberBillQuery memberBillQuery) {
		if(StringUtils.isEmpty(memberBillQuery.getUserId())) {
			result.setSuccess(false);
			result.setMsg("无效会员信息");
			return result;
		}
		memberBillQuery.setOrderColum("create_date");
		memberBillQuery.setOrderRule("DESC");
		DataGrid dg =  memberBillService.datagrid(memberBillQuery);
		result.setSuccess(true);
		result.setData(dg);
		return result;
	}
	
}
